const express =require('express')
const path = require('path')
const app = express()

app.get('/1',(request,response)=>{
    const failpath = path.resolve(__dirname,'./基础的get请求.html')
    response.sendFile(failpath)
})
app.get('/2',(request,response)=>{
    const failpath = path.resolve(__dirname,'./path的请求.html')
    response.sendFile(failpath)
})

app.get('/woaini',(request,response)=>{
    const data ={
        name : '张三',
        age:18,
        sex:'男'
    }
    const nula  ={
        name :'未知',
        age:'未知',
        sex:'未知'
    }
    // console.log(request.query);
   const {
    uresID
   } =request.query

   if(uresID !== '001'){
        response.send(nula)
   }

   if(uresID === '001'){
        response.send(data) 
   }





})
app.get('/woaini/:abc',(request,response)=>{
    console.log(request.params);
    const {
        abc 
    } = request.params
    if(abc==='001'){
        response.send({
            where: '中国',
            sex: '男',
            age:18

        })
    }
})
app.listen(4560,()=>{
    console.log('127.0.0.1:4560');
})